import { Provider } from 'react-redux';
import { store, persistor } from "./store";
import { PersistGate } from 'redux-persist/integration/react';
import { SearchPage, SearchFilter } from "./pages/Search";
import './styles/reset.scss';
import './App.css';
import RouteComponent, { RouteConfig } from './route';


const App = () => {
  const routes: RouteConfig[] = [
    {
      path: '/',
      component: '@/pages/Home',
    },
    {
      path: '/category',
      component: '@/pages/category',
    },
    {
      path: '/search',
      component: () => <SearchPage />,
    },
    {
      path: '/searchFilter',
      component: () => <SearchFilter />,
    },
    {
      path: '/goods/detail/:id',
      component: '@/pages/Goods/detail',
    },
    {
      path: '/comment',
      component: '@/components/comment',
    },
    {
      path: '/order/confirm',
      component: '@/pages/Order/confirmOrder'
    },
    {
      path: '/cashier',
      component: '@/pages/Pay/Cashier',
    },
    {
      path: '/address',
      component: '@/pages/address/AddressModel',
    },
    {
      path: '/sku',
      component: '@/components/sku',
    },
    {
      path: '/shoppingCart',
      component: '@/pages/ShoppingCart',
    },
  ]

  return (
    <>
      <Provider store={store}>
        <PersistGate loading={null} persistor={persistor}>
          <RouteComponent routes={routes} />
        </PersistGate>
      </Provider>
    </>
  );
};

export default App;
